home *** CD-ROM | disk | FTP | other *** search
/ Sports Illustrated for Kids - Awesome Athletes! / Sports Illustrated for Kids - Awesome Athletes!.iso / shared.dir / 07007_Idle Anim.ls < prev    next >
Encoding:
Text File  |  1996-04-18  |  12.7 KB  |  309 lines

  1. global gSIAnims, gSIAnimTable, gSIEventQ, gSIFlush, gSISystem, gSIAnimSprite, gSITextSprite, gSICurrMovie, goSIAnimAsset
  2.  
  3. on IAInit
  4.   set vSquirrel to []
  5.   add(vSquirrel, ["05squirrel01.pct", -9, 430])
  6.   add(vSquirrel, ["06squirrel01.pct", 37, 453])
  7.   add(vSquirrel, ["07squirrel01.pct", 37, 457])
  8.   add(vSquirrel, ["08squirrel01.pct", 53, 457])
  9.   add(vSquirrel, ["09squirrel01.pct", 46, 455])
  10.   add(vSquirrel, ["10squirrel01.pct", 43, 453])
  11.   add(vSquirrel, ["01squirrel01.pct", 55, 458])
  12.   add(vSquirrel, ["02squirrel02.pct", 92, 440])
  13.   add(vSquirrel, ["03squirrel01.pct", 141, 411])
  14.   add(vSquirrel, ["04squirrel01.pct", 189, 398])
  15.   add(vSquirrel, ["05squirrel01.pct", 220, 428])
  16.   add(vSquirrel, ["06squirrel01.pct", 266, 453])
  17.   add(vSquirrel, ["07squirrel01.pct", 266, 457])
  18.   add(vSquirrel, ["08squirrel01.pct", 282, 457])
  19.   add(vSquirrel, ["09squirrel01.pct", 275, 455])
  20.   add(vSquirrel, ["10squirrel01.pct", 272, 453])
  21.   add(vSquirrel, ["11.13squirrel01.pct", 271, 452])
  22.   add(vSquirrel, ["11.13squirrel01.pct", 271, 452])
  23.   add(vSquirrel, ["11.13squirrel01.pct", 271, 452])
  24.   add(vSquirrel, ["11.13squirrel01.pct", 271, 452])
  25.   add(vSquirrel, ["11.13squirrel01.pct", 271, 452])
  26.   add(vSquirrel, ["11.13squirrel01.pct", 271, 452])
  27.   add(vSquirrel, ["11.13squirrel01.pct", 271, 452])
  28.   add(vSquirrel, ["12squirrel01.pct", 272, 453])
  29.   add(vSquirrel, ["12squirrel01.pct", 272, 453])
  30.   add(vSquirrel, ["12squirrel01.pct", 272, 453])
  31.   add(vSquirrel, ["12squirrel01.pct", 272, 453])
  32.   add(vSquirrel, ["12squirrel01.pct", 272, 453])
  33.   add(vSquirrel, ["10squirrel01.pct", 272, 453])
  34.   add(vSquirrel, ["01squirrel01.pct", 284, 458])
  35.   add(vSquirrel, ["02squirrel02.pct", 321, 438])
  36.   add(vSquirrel, ["03squirrel01.pct", 370, 409])
  37.   add(vSquirrel, ["04squirrel01.pct", 418, 396])
  38.   add(vSquirrel, ["05squirrel01.pct", 444, 428])
  39.   add(vSquirrel, ["06squirrel01.pct", 490, 453])
  40.   add(vSquirrel, ["07squirrel01.pct", 490, 457])
  41.   add(vSquirrel, ["08squirrel01.pct", 506, 457])
  42.   add(vSquirrel, ["09squirrel01.pct", 499, 455])
  43.   add(vSquirrel, ["01squirrel01.pct", 507, 458])
  44.   add(vSquirrel, ["02squirrel02.pct", 544, 440])
  45.   add(vSquirrel, ["03squirrel01.pct", 593, 411])
  46.   add(vSquirrel, ["04squirrel01.pct", 641, 398])
  47.   set vSpidey to []
  48.   add(vSpidey, ["01.drop.spidey.2.pct", 312, -81])
  49.   add(vSpidey, ["01.drop.spidey.2.pct", 312, -79])
  50.   add(vSpidey, ["01.drop.spidey.2.pct", 312, -74])
  51.   add(vSpidey, ["01.drop.spidey.2.pct", 312, -64])
  52.   add(vSpidey, ["01.drop.spidey.2.pct", 312, -48])
  53.   add(vSpidey, ["01.drop.spidey.2.pct", 312, -28])
  54.   add(vSpidey, ["01.drop.spidey.2.pct", 312, -8])
  55.   add(vSpidey, ["01.drop.spidey.2.pct", 311, 13])
  56.   add(vSpidey, ["01.drop.spidey.2.pct", 311, 33])
  57.   add(vSpidey, ["01.drop.spidey.2.pct", 311, 53])
  58.   add(vSpidey, ["01.drop.spidey.2.pct", 311, 71])
  59.   add(vSpidey, ["01.drop.spidey.2.pct", 311, 86])
  60.   add(vSpidey, ["01.drop.spidey.2.pct", 311, 86])
  61.   add(vSpidey, ["01.drop.spidey.2.pct", 311, 86])
  62.   add(vSpidey, ["01.drop.spidey.2.pct", 311, 86])
  63.   add(vSpidey, ["01.drop.spidey.2.pct", 311, 86])
  64.   add(vSpidey, ["01.drop.spidey.2.pct", 311, 86])
  65.   add(vSpidey, ["01.drop.spidey.2.pct", 311, 86])
  66.   add(vSpidey, ["01.drop.spidey.2.pct", 311, 86])
  67.   add(vSpidey, ["01.drop.spidey.2.pct", 311, 86])
  68.   add(vSpidey, ["02.drop.spidey.2.pct", 310, 229])
  69.   add(vSpidey, ["03.drop.spidey.2.pct", 310, 282])
  70.   add(vSpidey, ["03.drop.spidey.2.pct", 310, 282])
  71.   add(vSpidey, ["04.drop.spidey.2.pct", 310, 341])
  72.   add(vSpidey, ["04.drop.spidey.2.pct", 310, 391])
  73.   add(vSpidey, ["05.drop.spidey.2.pct", 312, 471])
  74.   add(vSpidey, ["05.drop.spidey.2.pct", 312, 471])
  75.   add(vSpidey, ["05.drop.spidey.2.pct", 312, 471])
  76.   add(vSpidey, ["05.drop.spidey.2.pct", 312, 471])
  77.   add(vSpidey, ["05.drop.spidey.2.pct", 312, 471])
  78.   add(vSpidey, ["05.drop.spidey.2.pct", 312, 471])
  79.   add(vSpidey, ["05.drop.spidey.2.pct", 312, 471])
  80.   add(vSpidey, ["05.drop.spidey.2.pct", 312, 471])
  81.   add(vSpidey, ["05.drop.spidey.2.pct", 312, 471])
  82.   add(vSpidey, ["07.spidey.2.pct", 311, 460])
  83.   add(vSpidey, ["02.walk.spidey.2.pct", 308, 462])
  84.   add(vSpidey, ["03.walk.spidey.2.pct", 278, 464])
  85.   add(vSpidey, ["02.walk.spidey.2.pct", 267, 462])
  86.   add(vSpidey, ["03.walk.spidey.2.pct", 237, 464])
  87.   add(vSpidey, ["02.walk.spidey.2.pct", 227, 462])
  88.   add(vSpidey, ["03.walk.spidey.2.pct", 197, 464])
  89.   add(vSpidey, ["02.walk.spidey.2.pct", 186, 462])
  90.   add(vSpidey, ["03.walk.spidey.2.pct", 156, 464])
  91.   add(vSpidey, ["02.walk.spidey.2.pct", 144, 462])
  92.   add(vSpidey, ["03.walk.spidey.2.pct", 114, 464])
  93.   add(vSpidey, ["02.walk.spidey.2.pct", 103, 462])
  94.   add(vSpidey, ["03.walk.spidey.2.pct", 73, 464])
  95.   add(vSpidey, ["02.walk.spidey.2.pct", 63, 462])
  96.   add(vSpidey, ["03.walk.spidey.2.pct", 33, 464])
  97.   add(vSpidey, ["02.walk.spidey.2.pct", 22, 462])
  98.   add(vSpidey, ["03.walk.spidey.2.pct", -8, 464])
  99.   set vBird to []
  100.   add(vBird, ["02.bird.2.pct", 18, 149])
  101.   add(vBird, ["02.bird.2.pct", 40, 144])
  102.   add(vBird, ["02.bird.2.pct", 62, 139])
  103.   add(vBird, ["02.bird.2.pct", 83, 134])
  104.   add(vBird, ["02.bird.2.pct", 105, 129])
  105.   add(vBird, ["01.bird.2.pct", 120, 157])
  106.   add(vBird, ["03.bird.2.pct", 142, 157])
  107.   add(vBird, ["02.bird.2.pct", 182, 149])
  108.   add(vBird, ["02.bird.2.pct", 204, 144])
  109.   add(vBird, ["02.bird.2.pct", 226, 139])
  110.   add(vBird, ["02.bird.2.pct", 247, 134])
  111.   add(vBird, ["02.bird.2.pct", 269, 129])
  112.   add(vBird, ["01.bird.2.pct", 284, 157])
  113.   add(vBird, ["03.bird.2.pct", 306, 157])
  114.   add(vBird, ["02.bird.2.pct", 346, 149])
  115.   add(vBird, ["02.bird.2.pct", 368, 144])
  116.   add(vBird, ["02.bird.2.pct", 390, 139])
  117.   add(vBird, ["02.bird.2.pct", 411, 134])
  118.   add(vBird, ["02.bird.2.pct", 433, 129])
  119.   add(vBird, ["01.bird.2.pct", 448, 157])
  120.   add(vBird, ["03.bird.2.pct", 470, 157])
  121.   add(vBird, ["02.bird.2.pct", 510, 149])
  122.   add(vBird, ["02.bird.2.pct", 532, 144])
  123.   add(vBird, ["02.bird.2.pct", 554, 139])
  124.   add(vBird, ["02.bird.2.pct", 575, 134])
  125.   add(vBird, ["02.bird.2.pct", 597, 129])
  126.   add(vBird, ["01.bird.2.pct", 612, 157])
  127.   add(vBird, ["03.bird.2.pct", 634, 157])
  128.   set vBee to []
  129.   add(vBee, ["01.bee.2.pct", 647, 456])
  130.   add(vBee, ["03.bee.2.pct", 603, 439])
  131.   add(vBee, ["01.bee.2.pct", 560, 415])
  132.   add(vBee, ["03.bee.2.pct", 513, 393])
  133.   add(vBee, ["01.bee.2.pct", 476, 364])
  134.   add(vBee, ["03.bee.2.pct", 439, 334])
  135.   add(vBee, ["01.bee.2.pct", 438, 292])
  136.   add(vBee, ["01.bee.2.pct", 496, 218])
  137.   add(vBee, ["03.bee.2.pct", 542, 192])
  138.   add(vBee, ["01.bee.2.pct", 587, 170])
  139.   add(vBee, ["03.bee.2.pct", 611, 132])
  140.   add(vBee, ["01.bee.2.pct", 605, 93])
  141.   add(vBee, ["03.bee.2.pct", 566, 63])
  142.   add(vBee, ["01.bee.2.pct", 522, 43])
  143.   add(vBee, ["03.bee.2.pct", 473, 54])
  144.   add(vBee, ["01.bee.2.pct", 428, 77])
  145.   add(vBee, ["03.bee.2.pct", 397, 108])
  146.   add(vBee, ["01.bee.2.pct", 372, 142])
  147.   add(vBee, ["03.bee.2.pct", 340, 175])
  148.   add(vBee, ["01.bee.2.pct", 288, 186])
  149.   add(vBee, ["03.bee.2.pct", 236, 174])
  150.   add(vBee, ["01.bee.2.pct", 216, 138])
  151.   add(vBee, ["03.bee.2.pct", 242, 103])
  152.   add(vBee, ["01.bee.2.pct", 274, 67])
  153.   add(vBee, ["03.bee.2.pct", 244, 33])
  154.   add(vBee, ["01.bee.2.pct", 199, 32])
  155.   add(vBee, ["03.bee.2.pct", 153, 51])
  156.   add(vBee, ["01.bee.2.pct", 140, 91])
  157.   add(vBee, ["03.bee.2.pct", 134, 133])
  158.   add(vBee, ["01.bee.2.pct", 143, 172])
  159.   add(vBee, ["03.bee.2.pct", 170, 209])
  160.   add(vBee, ["01.bee.2.pct", 205, 239])
  161.   add(vBee, ["03.bee.2.pct", 246, 265])
  162.   add(vBee, ["01.bee.2.pct", 296, 273])
  163.   add(vBee, ["03.bee.2.pct", 345, 290])
  164.   add(vBee, ["01.bee.2.pct", 405, 285])
  165.   add(vBee, ["03.bee.2.pct", 458, 261])
  166.   add(vBee, ["01.bee.2.pct", 501, 223])
  167.   add(vBee, ["03.bee.2.pct", 481, 183])
  168.   add(vBee, ["01.bee.2.pct", 450, 150])
  169.   add(vBee, ["03.bee.2.pct", 401, 143])
  170.   add(vBee, ["01.bee.2.pct", 349, 171])
  171.   add(vBee, ["03.bee.2.pct", 305, 202])
  172.   add(vBee, ["01.bee.2.pct", 281, 241])
  173.   add(vBee, ["03.bee.2.pct", 268, 287])
  174.   add(vBee, ["01.bee.2.pct", 288, 329])
  175.   add(vBee, ["03.bee.2.pct", 329, 361])
  176.   add(vBee, ["01.bee.2.pct", 349, 403])
  177.   add(vBee, ["03.bee.2.pct", 309, 440])
  178.   add(vBee, ["01.bee.2.pct", 259, 427])
  179.   add(vBee, ["03.bee.2.pct", 209, 404])
  180.   add(vBee, ["01.bee.2.pct", 159, 391])
  181.   add(vBee, ["03.bee.2.pct", 104, 380])
  182.   add(vBee, ["01.bee.2.pct", 54, 367])
  183.   add(vBee, ["03.bee.2.pct", -6, 367])
  184.   set gSIAnimTable to [#Squirrel: vSquirrel, #Spidey: vSpidey, #Bird: vBird, #Bee: vBee]
  185.   set gSIAnims to ["th": [[#Squirrel, 0, 0], [#Bird, 0, 280]], "iv": [[#Squirrel, 0, 0], [#Spidey, 0, 0], [#Bird, 0, 0], [#Bee, 0, 0]], "hf": [[#Squirrel, 0, 0], [#Spidey, 0, 0], [#Bird, 0, 0], [#Bee, 0, 0]], "wd": [[#Squirrel, 0, 0], [#Bird, 0, 280], [#Spidey, -50, 0]], "ma": [[#Squirrel, 0, 0], [#Spidey, 0, 0], [#Bird, 0, 0], [#Bee, 0, 0]], "tr": [[#Squirrel, 0, 0], [#Spidey, 0, 0], [#Bird, 0, 0], [#Bee, 0, 0]], "sd": [[#Spidey, 0, 0], [#Bee, 0, 0]]]
  186.   set goSIAnimAsset to birth(script "AssetManager", 7429)
  187. end
  188.  
  189. on RunIdleAnim aSprite, aTextSprite, aModule, aAnimList, aDX, aDY
  190.   global gTHRefresh
  191.   set vFrames to count(aAnimList)
  192.   set vSaveVis to the visible of sprite aSprite
  193.   set vSaveVis2 to the visible of sprite aTextSprite
  194.   set vSaveX to the locH of sprite aSprite
  195.   set vSaveX2 to the locH of sprite aTextSprite
  196.   set vSaveY to the locV of sprite aSprite
  197.   set vSaveY2 to the locV of sprite aTextSprite
  198.   set vSaveCast to the castNum of sprite aSprite
  199.   set vSaveCast2 to the castNum of sprite aTextSprite
  200.   set vSaveInk to the ink of sprite aSprite
  201.   set vSaveInk2 to the ink of sprite aTextSprite
  202.   puppetSprite(aSprite, 1)
  203.   set the ink of sprite aSprite to 8
  204.   set the stretch of sprite aSprite to 0
  205.   set the visible of sprite aSprite to 1
  206.   set the visible of sprite aTextSprite to 0
  207.   set vHit to 0
  208.   StartBufferingEvents()
  209.   repeat with vI = 1 to vFrames
  210.     set vNextTime to the timer + 5
  211.     set vFrameInfo to getAt(aAnimList, vI)
  212.     set the castNum of sprite aSprite to cast mGetAssetNo(goSIAnimAsset, aModule & "." & getAt(vFrameInfo, 1))
  213.     set the locH of sprite aSprite to getAt(vFrameInfo, 2) + aDX
  214.     set the locV of sprite aSprite to getAt(vFrameInfo, 3) + aDY
  215.     updateStage()
  216.     if the mouseDown then
  217.       if the mouseCast = the castNum of sprite aSprite then
  218.         set vHit to 1
  219.         exit repeat
  220.       end if
  221.     end if
  222.     repeat while the timer < vNextTime
  223.       nothing()
  224.     end repeat
  225.   end repeat
  226.   EndBufferingEvents()
  227.   StartBufferingEvents()
  228.   if vHit then
  229.     set vFact to random(95)
  230.     if vFact < 10 then
  231.       set vFact to "FF0" & vFact
  232.     else
  233.       set vFact to "FF" & vFact
  234.     end if
  235.     set the castNum of sprite aSprite to cast mGetAssetNo(goSIAnimAsset, "FactBox")
  236.     set the locH of sprite aSprite to (the stageRight - the stageLeft) / 2
  237.     set the locV of sprite aSprite to (the stageBottom - the stageTop) / 2
  238.     set the castNum of sprite aTextSprite to cast mGetAssetNo(goSIAnimAsset, vFact)
  239.     set the locH of sprite aTextSprite to ((the stageRight - the stageLeft) / 2) - (the width of cast mGetAssetNo(goSIAnimAsset, "FactBox") / 2) + 6
  240.     set the locV of sprite aTextSprite to ((the stageBottom - the stageTop) / 2) - (the height of cast mGetAssetNo(goSIAnimAsset, "FactBox") / 2) + 6
  241.     set the ink of sprite aTextSprite to 1
  242.     set the visible of sprite aTextSprite to 1
  243.     updateStage()
  244.     set vNextTime to the timer + 120
  245.     repeat while the timer < vNextTime
  246.       nothing()
  247.     end repeat
  248.     EndBufferingEvents()
  249.     StartBufferingEvents()
  250.     repeat while not (the mouseDown)
  251.       nothing()
  252.     end repeat
  253.     EndBufferingEvents()
  254.     StartBufferingEvents()
  255.     if gSICurrMovie = "th" then
  256.       set gTHRefresh to 1
  257.     end if
  258.   end if
  259.   set the visible of sprite aSprite to vSaveVis
  260.   set the castNum of sprite aSprite to vSaveCast
  261.   set the locH of sprite aSprite to vSaveX
  262.   set the locV of sprite aSprite to vSaveY
  263.   set the ink of sprite aSprite to vSaveInk
  264.   set the visible of sprite aTextSprite to vSaveVis2
  265.   set the castNum of sprite aTextSprite to vSaveCast2
  266.   set the locH of sprite aTextSprite to vSaveX2
  267.   set the locV of sprite aTextSprite to vSaveY2
  268.   set the ink of sprite aTextSprite to vSaveInk2
  269.   puppetSprite(aSprite, 0)
  270.   puppetSprite(aTextSprite, 0)
  271.   updateStage()
  272.   EndBufferingEvents()
  273. end
  274.  
  275. on DoIdleAnim aSprite, aTextSprite, aModule
  276.   set vList to getaProp(gSIAnims, aModule)
  277.   set vAnim to getAt(vList, random(count(vList)))
  278.   RunIdleAnim(aSprite, aTextSprite, aModule, getaProp(gSIAnimTable, getAt(vAnim, 1)), getAt(vAnim, 2), getAt(vAnim, 3))
  279. end
  280.  
  281. on EnableIdleAnim aAnimSprite, aTextSprite
  282.   set the timeoutMouse to 1
  283.   set the timeoutKeyDown to 1
  284.   set the timeoutLength to 2400
  285.   set gSIAnimSprite to aAnimSprite
  286.   set gSITextSprite to aTextSprite
  287.   set the timeoutScript to "IdleScript"
  288. end
  289.  
  290. on DisableIdleAnim
  291.   set the timeoutScript to EMPTY
  292. end
  293.  
  294. on IdleScript
  295.   global gTHRefresh
  296.   set vDoIdle to value(HSStateGet("opt", "Idle"))
  297.   if not vDoIdle then
  298.     exit
  299.   end if
  300.   DoIdleAnim(gSIAnimSprite, gSITextSprite, gSICurrMovie)
  301.   if gSICurrMovie = "th" then
  302.     set gTHRefresh to 1
  303.   else
  304.     if gSICurrMovie = "wd" then
  305.       RefreshScreen()
  306.     end if
  307.   end if
  308. end
  309.